KEXEC: disconnect all PCI devices from the PCI bus on crash
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 8 Jul 2011 07:38:35 +0000 (08:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 8 Jul 2011 07:38:35 +0000 (08:38 +0100)
commitc24c3e21e3c966a1fefc8c3beeb11a6a045ffe5c
treeb3a59c1434dd450da2548b075f7fd9c3e56b0c5e
parent56a86d9c66c355da0433b86fe893b06d9829ac0c
KEXEC: disconnect all PCI devices from the PCI bus on crash

In the case of a crash, IOMMU DMA remapping gets turned off so that
the kdump kernel may boot.  However, this is warned as being dangerous
in the VTD specification if a DMA transaction is in progress.

Also, in the case of a crash, DMA transactions and interrupts from
peripheral devices such as network cards are likely to keep coming in.
Without DMA remapping enabled, the transactions will be writing over
low memory, corrupting the crash state, and perhaps even the kdump
reserved memory.

Therefore, on the crash path, we can disconnect all PCI devices from
their respective buses so that they are no longer able to be DMA
busmasters.  This reduces the risk of DMA transactions corrupting
state (and will also reduce spurious interrupts arriving to the kdump
kernel) until the kdump kernel and properly reset the PCI devices.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/crash.c
xen/drivers/passthrough/pci.c
xen/include/xen/pci.h